package info.motteke.mixivoice4j;

/* package */ class ImmutableUser implements User {

    private final long id;

    private final String nickname;

    private final ImageUrl thumbnail;

    public ImmutableUser(long id, String nickname, ImageUrl thumbnail) {
        this.id = id;
        this.nickname = nickname;
        this.thumbnail = thumbnail;
    }

    @Override
    public long getId() {
        return id;
    }

    @Override
    public String getNickName() {
        return nickname;
    }

    @Override
    public ImageUrl getThumbnail() {
        return thumbnail;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (int) (id ^ (id >>> 32));
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        ImmutableUser other = (ImmutableUser) obj;
        if (id != other.id)
            return false;
        return true;
    }

    @Override
    public String toString() {
        return nickname;
    }
}
